<?php
    use User\Model\LpicModel;
?>
<!-- page heading start-->
<div class="page-heading">
    <h3>
        图文直播列表
    </h3>

</div>
<!-- page heading end-->
<div class="row">
    <div class="col-sm-12">
        <section class="panel">
            <header class="panel-heading">
                <a class="btn btn-default" href="/User/Lpic/lpicAdd">增加</a>
            </header>
            <div class="panel-body">
                <table class="table table-hover general-table table-bordered">
                    <thead>
                    <tr>
                        <th width="12%">活动名称</th>
                        <th width="12%">链接首页地址</th>
                        <th width="8%">状态</th>
                        <th width="10%">创建时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($list as $val){?>
                    <tr>
                        <td>
                            <span>
                                <?php echo $val['name'];?>
                            </span>
                        </td>
                        <td>
                            <span style="word-wrap:break-word">
                                <?php
                                echo "观众页面：" . "http://" . $_SERVER['SERVER_NAME'] . "/Wap/Lpic/index?id=" . $val['id'] . "<br>";
                                    echo "上传页面：" . "http://" . $_SERVER['SERVER_NAME'] . "/Wap/Lpic/login?id=" . $val['id'] . "<br>";
                                ?>
                            </span>
                        </td>
                        <td>
                            <span>
                                <?php echo LpicModel::getStatus($val['status']);?>
                            </span>
                        </td>
                        <td>
                            <span>
                                <?php echo $val['added_date'];?>
                            </span>
                        </td>
                        <td>
                            <div>
                                <a class="btn btn-success"
                                   href="<?php echo '/User/Lpic/lpicUpdate?type=update&id=' . $val['id'];?>">编辑</a>
                                <a class="btn btn-info" href="#"
                                   onclick="<?php echo 'return active_data(' . $val['id'] .')';?>">发布</a>
                                <a class="btn btn-warning" href="#"
                                   onclick="<?php echo 'return pending_data(' . $val['id'] .')';?>">停用</a>
                                <a class="btn btn-default" href="<?php echo '/User/Lpic/share?id=' . $val['id'];?>" >分享设置</a>
                                <a class="btn btn-danger" href="#"
                                   onclick="<?php echo 'return delete_data(' . $val['id'] .')';?>">删除</a>
                            </div>
                            <div style="margin-top: 20px;">
                                <a class="btn btn-success" href="<?php echo '/User/Lpic/item?id=' . $val['id'];?>" >专题</a>
                                <a class="btn btn-info" href="<?php echo '/User/Lpic/pic?id=' . $val['id'];?>" >图集</a>
                                <a class="btn btn-warning" href="<?php echo '/User/Lpic/register?id=' . $val['id'];?>" >用户管理</a>
                                <a class="btn btn-default" href="<?php echo '/User/Lpic/menu?id=' . $val['id'];?>" >菜单</a>
                            </div>
                        </td>
                    </tr>
                    <?php }?>

                    </tbody>
                </table>
                <div class="pages">
                    {$page}
                </div>
            </div>
        </section>
    </div>
</div>
<script>
    function delete_data(id){
        $.ajax({
            data:{id:id},
            dataType:'json',
            url:'/User/Lpic/lpicDelete',
            type:'get',
            success:function(res){
                window.location.reload();
            }
        });
        return false;
    }
    function active_data(id){
        $.ajax({
            data:{id:id},
            dataType:'json',
            url:'/User/Lpic/lpicActive',
            type:'get',
            success:function(res){
                window.location.reload();
            }
        });
        return false;
    }
    function pending_data(id){
        $.ajax({
            data:{id:id},
            dataType:'json',
            url:'/User/Lpic/lpicPend',
            type:'get',
            success:function(res){
                window.location.reload();
            }
        });
        return false;
    }
</script>